<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Онлайн сервис для подсветки кода</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
  <link rel="stylesheet" title="Default" href="http://sedegoff-blogger.googlecode.com/svn/blogger/css/highlight/default.css">
  <link rel="alternate stylesheet" title="Dark" href="http://sedegoff-blogger.googlecode.com/svn/blogger/css/highlight/dark.css">
  <link rel="alternate stylesheet" title="FAR" href="http://sedegoff-blogger.googlecode.com/svn/blogger/css/highlight/far.css">
  <link rel="alternate stylesheet" title="IDEA" href="http://sedegoff-blogger.googlecode.com/svn/blogger/css/highlight/idea.css">
  <link rel="alternate stylesheet" title="Sunburst" href="http://sedegoff-blogger.googlecode.com/svn/blogger/css/highlight/sunburst.css">
  <link rel="alternate stylesheet" title="Zenburn" href="http://sedegoff-blogger.googlecode.com/svn/blogger/css/highlight/zenburn.css">
  <link rel="alternate stylesheet" title="Visual Studio" href="http://sedegoff-blogger.googlecode.com/svn/blogger/css/highlight/vs.css">
  <link rel="alternate stylesheet" title="Ascetic" href="http://sedegoff-blogger.googlecode.com/svn/blogger/css/highlight/ascetic.css">
  <link rel="alternate stylesheet" title="Magula" href="http://sedegoff-blogger.googlecode.com/svn/blogger/css/highlight/magula.css">
  <link rel="alternate stylesheet" title="GitHub" href="http://sedegoff-blogger.googlecode.com/svn/blogger/css/highlight/github.css">
  <link rel="alternate stylesheet" title="Brown Paper" href="http://sedegoff-blogger.googlecode.com/svn/blogger/css/highlight/brown_paper.css">
  <link rel="alternate stylesheet" title="School Book" href="http://sedegoff-blogger.googlecode.com/svn/blogger/css/highlight/school_book.css">
  <link rel="alternate stylesheet" title="IR_Black" href="http://sedegoff-blogger.googlecode.com/svn/blogger/css/highlight/ir_black.css">
  <script src="http://sedegoff-blogger.googlecode.com/svn/blogger/js/highlight/highlight.js"></script>
  <script>hljs.initHighlightingOnLoad();</script>
  <style>
     #switch {
      overflow: auto; width: 35em;
      list-style: none;
      padding: 0; margin: 0;
    }
    #switch li {
      float: left; width: 7em;
      padding: 0.1em; margin: 0.1em 1em 0.1em 0;
      background: #EEE;
      cursor: pointer;
      font-size: 12px;
    }
    #switch li.current {
      background: #CCC;
      font-weight: bold;
    }

    #t1, #t2, #t3 { width: 100%;}

  </style>
  </head>
  <body style="width: 540px;">
    <script type="text/javascript">
      var current = null;
      String.prototype.escape = function() {
                return this.replace(/&/gm, '&amp;').replace(/</gm, '&lt;').replace(/>/gm, '&gt;');
            }
                function getElementComputedStyle(elem, prop)
{
  if (typeof elem!="object") elem = document.getElementById(elem);

  // external stylesheet for Mozilla, Opera 7+ and Safari 1.3+
  if (document.defaultView && document.defaultView.getComputedStyle)
  {
    if (prop.match(/[A-Z]/)) prop = prop.replace(/([A-Z])/g, "-$1").toLowerCase();
    return document.defaultView.getComputedStyle(elem, "").getPropertyValue(prop);
  }

  // external stylesheet for Explorer and Opera 9
  if (elem.currentStyle)
  {
    var i;
    while ((i=prop.indexOf("-"))!=-1) prop = prop.substr(0, i) + prop.substr(i+1,1).toUpperCase() + prop.substr(i+2);
    return elem.currentStyle[prop];
  }

  return "";
}

function clearClass(object){
 for(var i=0;i<object.childNodes.length;i++) {
      if (object.childNodes[i].nodeType == 1) {
      var item = object.childNodes[i];
      color = getElementComputedStyle(item, 'color'); if("rgb(0, 0, 0)" != color && "#000000"  != color ) item.style.color = color;
      display = getElementComputedStyle(item, 'display'); if("inline" != display) item.style.display = display;      
      fontWeight = getElementComputedStyle(item, 'font-weight'); if("normal"!=fontWeight&&"400"!=fontWeight) item.style.fontWeight =  fontWeight;
      opacity = getElementComputedStyle(item, 'opacity'); if("1"!=opacity&&!isNaN(opacity)) item.style.opacity = opacity;
      fontStyle= getElementComputedStyle(item, 'font-style');if("normal"!=fontStyle)item.style.fontStyle = fontStyle;
      textDecoration = getElementComputedStyle(item, 'text-decoration');if("none"!=textDecoration) item.style.textDecoration = textDecoration;
      lineHeight = getElementComputedStyle(item, 'line-height');if("normal"!=lineHeight&&"16px"!=lineHeight)item.style.lineHeight = lineHeight;      
      if("CODE"==item.nodeName.toUpperCase() ){
        //Надо задать настройку для блока CODE
        item.style.display="block";
        item.style.padding="0.5em";
        item.style.border="solid 2px #D7E8F0";
        item.style.overflow="auto";
        if("Default" == current.link.title){item.style.backgroundColor="#F0F0F0";}
        else
        if("Dark" == current.link.title){item.style.backgroundColor="#444";}
        else
        if("FAR" == current.link.title){item.style.backgroundColor="#000080";}
        else
        if("IDEA" == current.link.title){item.style.backgroundColor="#fff"; item.style.color="#000";}
        else
        if("Sunburst" == current.link.title || "IR_Black" == current.link.title){item.style.backgroundColor="#000"; item.style.color="#f8f8f8";}
        else
        if("Zenburn" == current.link.title){item.style.backgroundColor="#3F3F3F"; item.style.color="#DCDCDC";}
        else
        if("Visual Studio" == current.link.title){}
        else
        if("Ascetic" == current.link.title){item.style.backgroundColor="white"; item.style.color="black";}
        else
        if("Magula" == current.link.title){item.style.backgroundColor="#f4f4f4";}
        else
        if("GitHub" == current.link.title){item.style.backgroundColor="#f8f8ff"; item.style.color="#000";}
        else
        if("Brown Paper" == current.link.title){item.style.background="#b7a68e url(http://sedegoff-blogger.googlecode.com/svn/blogger/img/brown_papersq.png)";}
        else
        if("School Book" == current.link.title){item.style.padding="15px 0.5em 0.5em 30px"; item.style.fontSize="11px !important"; item.style.lineHeight="16px !important"; item.style.background="#f6f6ae url(http://sedegoff-blogger.googlecode.com/svn/blogger/img/school_book.png)"; item.style.borderTop="solid 2px #d2e8b9"; item.style.borderBottom="solid 1px #d2e8b9";}       

      }
      clearClass(item);
      item.removeAttribute('class');
    }
  }

}

function srcsoftChangeStyle(){

  el = document.getElementById('highStyler');
  var links = document.getElementsByTagName('link');
          for (var i = 0; (link = links[i]); i++) {
              if (link.getAttribute('rel').indexOf('style') != -1
                  && link.title) {

                      if(link.title == el.value)
                        link.disabled = false;
                      else
                        link.disabled = true;
                  }
          }

}


            String.prototype.escape = function() {
                return this.replace(/&/gm, '&amp;').replace(/</gm, '&lt;').replace(/>/gm, '&gt;');
            }

            function doIt() {
                var viewDiv = document.getElementById("highlight-view");
                var viewNoClassDiv = document.getElementById('highlight-view-noclass');
                var t1 = document.getElementById("t1");
                var t2 = document.getElementById("t2");
                var t3 = document.getElementById("t3");
                if ("" == t1.value){
                  t2.value = "";
                  t3.value = "";
                  viewDiv.innerHTML="";
                  viewNoClassDiv="";
                  return;
                }
                var selector = document.getElementById("langSelector");
                var selectedLang = selector.options[selector.selectedIndex].value.toLowerCase();
                if(selectedLang) {
                    viewDiv.innerHTML = '<pre><code class="'+selectedLang+'">'+t1.value.escape()+"</code></pre>";
                } else { // try auto
                    viewDiv.innerHTML = '<pre><code>' + t1.value.escape() + "</code></pre>";
                }
                hljs.highlightBlock(viewDiv.firstChild.firstChild);
                t2.value = viewDiv.innerHTML;                                
                viewNoClassDiv.innerHTML = viewDiv.innerHTML;
                clearClass(viewNoClassDiv);
                t3.value = viewNoClassDiv.innerHTML;
            }

            function selectText(aElement){
              aElement.select();
            }

    </script>
    <form name="configure" action="">
    <ol>
      <li><span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">Выберите язык: <span id="srcsoftLangOption"></span> </span>Для HTML - выбирайте XML.</li>
      <li><span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">Выберите стиль: </span><br/> <span id="srcsoftSstyle"></span> </li>
      <li><span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">Введите исходный код:</span><br/><textarea rows="10" cols="50" id="t1"></textarea> </li>
      <li><span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">Нажмите кнопку:</span><input type="button" value="Раскрасить" onclick="doIt()"/></li>
      <li><span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">Код будет выглядеть вот так:</span><br/><div id="highlight-view" style="height: 150px; overflow: auto;"></div> <div id="highlight-view-noclass" style="display: none"></div> </li>
      <li><span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">Готовый для вставки HTML код:</span><br/><textarea rows="10" cols="50" id="t3" onfocus="selectText(this);" onclick="selectText(this);"></textarea> </li>
      <li><span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">Код HTML, для которого должен быть подключен файл стиля:</span><br/><textarea rows="10" cols="50" id="t2"  onfocus="selectText(this);" onclick="selectText(this);"></textarea><br/><span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif; font-size: large;"><b>Внимание!</b> Что бы этот код у Вас выглядел как показано выше, у Вас должен быть подключен файл стиля:</span><br/>
      <pre><code class="xml" data-result="[object Object]"><span class="tag">&lt;<span class="title">link</span> <span class="attribute">rel</span>=<span class="value">"stylesheet"</span> <span class="attribute">title</span>=<span class="value">"Default"</span> <span class="attribute">href</span>=<span class="value">"<span id="spanURL">http://sedegoff-blogger.googlecode.com/svn/blogger/css/highlight/default.css</span>"</span>&gt;</span></code></pre>
      </li> 
    </ol>
    </form>
    <span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', serif; font-size: large;">Данная страница может отображаться только на <a href="http://www.sedegoff.com/2011/05/onlajn-servis-po-raskraske-ishodnogo.html">www.sedegoff.com</a>. Если Вы видите эту страницу на другом сайте, сообщите пожалуйста это мне - оставьте комментарий в блоге. Спасибо.</span>
    Если Вы хотите использовать эту страницу у себя - свяжитесь со мной и мы решим этот вопрос!
    <script type="text/javascript">
      var langSelectorHtml = '<select id="langSelector">';
      langSelectorHtml += '<option value="">Auto</option>';
      for (var i in hljs.LANGUAGES) {
        if (hljs.LANGUAGES.hasOwnProperty(i))
          langSelectorHtml += '<option value=\"'+i+'\">'+i.charAt(0).toUpperCase()+i.substr(1)+'</option>';
      }
      langSelectorHtml += '</select>';
      document.getElementById('srcsoftLangOption').innerHTML = langSelectorHtml;

       if (window.addEventListener) {
          var attach = function(el, ev, handler) {
              el.addEventListener(ev, handler, false);
          }
      } else if (window.attachEvent) {
          var attach = function(el, ev, handler) {
              el.attachEvent('on' + ev, handler);
          }
      } else {
          var attach = function(el, ev, handler) {
              ev['on' + ev] = handler;
          }
      }
          var info = {};
          var links = document.getElementsByTagName('link');
          var ul = document.createElement('ul')


          for (var i = 0; (link = links[i]); i++) {
              if (link.getAttribute('rel').indexOf('style') != -1
                  && link.title) {

                  var title = link.title;

                  info[title] = {
                  'link': link ,
                  'li': document.createElement('li')
                  }                  
                  ul.appendChild(info[title].li)
                  info[title].li.title = title;

                  info[title].link.disabled = true;

                  info[title].li.appendChild(document.createTextNode(title));
                  attach(info[title].li, 'click', (function (el) {
                      return function() {
                          current.li.className = '';
                          current.link.disabled = true;                         
                          current = el;
                          current.li.className = 'current';
                          current.link.disabled = false;
                          document.getElementById('spanURL').innerHTML = current.link.href.toString();
                          doIt();
                      }})(info[title]));
              }
          }

          current = info['Default']          
          current.li.className = 'current';
          current.link.disabled = false;
          ul.id = 'switch';
          container = document.getElementById('srcsoftSstyle');
          container.appendChild(ul);

    </script>
  </body>
</html>
